/**
 * Description
 *
 * Creation Date 26/12/2017
 * @author Candy
 */
import React, { Component } from 'react';
import { BrowserRouter,  Route, Switch, Redirect } from 'react-router-dom';
import asyncComponent from '../component/AsyncComponent';


const Home = asyncComponent(() => import("../pages/Home/index"));
const Category = asyncComponent(() => import("../pages/Category/index"));
const Product = asyncComponent(() => import("../pages/Product/index"));
const Cart = asyncComponent(() => import("../pages/Cart/index"));
const Login = asyncComponent(() => import("../pages/Login/index"));
const Payment = asyncComponent(() => import("../pages/Payment/index"));
const Profile = asyncComponent(() => import("../pages/Profile/index"));


const RouteConfig = (
	<BrowserRouter>
		<div>
			<Switch>
				<Route path="/home" exact={true} component={ Home } />
				<Route path="/category/" component={ Category } />
				<Route path="/product/:id" component={ Product } />
				<Route path="/cart" component={ Cart } />
				<Route path="/login" component={ Login } />
				<Route path="/payment" component={ Payment } />
				<Route path="/profile" component={ Profile } />
				<Redirect from='/' to='/home'/>
			</Switch>
		</div>
	</BrowserRouter>
);

export default RouteConfig;